<?
if (!defined('MODULE_FILE')){
die ("cant access file directly!");
}
	$userid=$_GET['uid'];
	$mid2=$_GET['mid'];
	$smid=$_GET['smid'];
	
require_once 'class/EmpRegister.php';
require_once 'class/NewModule.php';

//For User name	
$userobj = new EmpRegister();
$Usresult = $userobj->get1($userid);
$name=$Usresult[0]['Name'];

$att = new NewModule();
$result = $att->AllList();	
$n = 0;
?>
	<div style="margin-left:20px; margin-top: 10px;">
		<p>
			<a class="btn btn-outline btn-primary btn-xs" id="active" href="modules.php?file=user_list&mid=<? echo $mid;?>&smid=<? echo $smid;?>" >List</a>
			<a class="btn btn-outline btn-primary btn-xs" id="act" href="modules.php?file=user_add&mid=<? echo $mid;?>&smid=<? echo $smid;?>" >Add User</a>
		</p>
	</div>

<div class="col-lg-8">
<div class="panel panel-default">
<div class="panel-heading"><i class="fa fa-bell fa-fw"></i>Access Control( <span style="font-size: 16px; color: #A52A2A;"><b><? echo $name;?></b></span> )</div>
<div class="panel-body">
<div class="table-responsive">

<form action="" method="POST">
<table style="font-size: 16px; color: #666666;  width: 600px;" border="0" cellspacing="3" cellpadding="0" >
	<?
	for ($i = 0; $i < count($result); $i++)
	{
	    $n++;
		$mid11=$result[$i]['mid'];
		$row_link = $att->getlink($userid,$mid11);	
		$lk_id = $row_link[0]['link_id']; 	
		$level_id = $row_link[0]['level_id'];
		
		if ($level_id==0){$access_img="<img border='0' src='images/delete.png'>";}
		if ($level_id==1){$access_img="<img border='0' src='images/green_tick.gif'><font style='color:green'><b>W</b></font>";}	
	?>
	<tr>   
		<td width=50%><font size=2><b> <?echo $result[$i]['title']; echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";	?></td> 
		<td><font size="2"><b> <a class='vsmenu' href='modules.php?file=edit_access&mid1=<? echo $result[$i]['mid'];?>&level_id=<? echo $level_id; ?>&uid=<? echo $userid;?>&mid=<? echo $mid2;?>&smid=<? echo $smid;?>&linkid=<?echo $lk_id;?>'><? echo $access_img;//echo $lk_id;?></a> </td>   
	</tr>	
	
	<?
	$result1 = $att->AllList1($mid11);
	for ($j = 0; $j < count($result1); $j++)
	{
		$mid33 = $result1[$j]['mid'];
		$row_link1 = $att->getlink($userid,$mid33);
		$lk_id1=$row_link1[0]['link_id'];
		$level_id=$row_link1[0]['level_id'];
		
		if ($level_id==0){$access_img="<img border='0' src='images/delete.png'>";}
		if ($level_id==1){$access_img="<img border='0' src='images/green_tick.gif'><font style='color:green'><b>W</b></font>";}
	?>
	<tr>
		<td ><?  echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp"; echo $result1[$j]['title'];?>	</td> 
		<td><a class='vsmenu' href='modules.php?file=edit_access&mid1=<? echo $result1[$j]['mid'];?>&level_id=<? echo $level_id; ?>&uid=<? echo $userid;?>&mid=<? echo $mid2;?>&smid=<? echo $smid;?>&linkid=<?echo $lk_id1;?>'><? echo $access_img;?></a></td>
	</tr>	
		<?	
			$mid44=$result1[$j]['mid']; 
			$result2 = $att->AllList1($mid44);
			for ($k = 0; $k < count($result2); $k++)
			{
			$mid55=$result2[$k]['mid'];
			$row_link2 = $att->getlink($userid,$mid55);
			$lk_id2 = $row_link2[0]['link_id'];
			$level_id = $row_link2[0]['level_id'];
			
			if ($level_id==0){$access_img="<img border='0' src='images/delete.png'>";}
			if ($level_id==1){$access_img="<img border='0' src='images/green_tick.gif'><font style='color:green'><b>W</b></font>";}
			?>
	<tr>   
		<td ><?echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"; echo $result2[$k]['title'];?></td> 
		<td><a class='vsmenu' href='modules.php?file=edit_access&mid1=<? echo $result2[$k]['mid'];?>&level_id=<? echo $level_id; ?>&uid=<? echo $userid;?>&mid=<? echo $mid2;?>&smid=<? echo $smid;?>&linkid=<?echo $lk_id2;?>'><? echo $access_img;?></a></td>
	<tr/>
	<?  
	        }
				
	}
		
	}
	?>
	<tr>
		<td></td>
		<td></td>
	</tr>
</table>
</form>
</div>
</div>
</div>
</div>